package com.msmall.community.common.service;

import com.msmall.base.service.BaseManager;
import com.msmall.community.common.model.RankRule;
import com.msmall.community.user.model.UserInfo;

public interface RankRuleManager extends BaseManager<RankRule, Long>{

	/**
	 * 先从缓存读取，如果没有，从数据库读取
	 * @param level
	 * @return
	 * @throws Exception
	 */
	public RankRule getRankRule(int level) throws Exception;
	
	/**
	 * 直接从数据库读取
	 * @param level
	 * @return
	 * @throws Exception
	 */
	public RankRule loadRankRule(int level) throws Exception;
	
	public void saveRankRule(RankRule rankRule);

	public boolean promotion(UserInfo userInfo);
	
	/**
	 * true 可以升级，false不能升级
	 * @param levels
	 * @param score
	 * @return
	 */
	public boolean promotion(int levels, Long score);
}
